#!/usr/bin/env python
#-*- encoding:UTF-8 -*-

# $Id$

import wx
import wx.grid
import os
import sys

_thisProgramDir = os.path.dirname(sys.argv[0])

class project_config():
    """
    Config for Project
    """
    
    def __init__(self, parent, id=wx.ID_ANY):
        
        [wxID_Save,
         wxID_Discard,
         wxID_New,
         wxID_Close,
         wxID_Delete
        ] = [wx.NewId() for _init_ctrls in range(5)]
        
        self.win = wx.MDIChildFrame(parent, -1, "Project Configaration")
        self.win.Centre()
        self.win.Maximize(True)
        
        self.win.SetIcon(wx.Icon(_thisProgramDir+'\\pycon.ico', wx.BITMAP_TYPE_ICO))
        
        self.panel = wx.Panel(self.win, wx.ID_ANY)
        self.panel.SetBackgroundColour('light blue')
        self.win.Show(True)

        self.grid = wx.grid.Grid(self.panel)
        self.grid.CreateGrid(50,3)
        
        self.vbox = wx.BoxSizer(wx.VERTICAL)
        self.vbox.Add(self.grid, 10, wx.EXPAND | wx.ALL, 2)

        
        # Save, Discard,
        self.save = wx.Button(self.panel,wxID_Save, "&Save")
        self.discard = wx.Button(self.panel,wxID_Discard, "Discard")
        self.new = wx.Button(self.panel,wxID_New, "&New...")
        self.delete = wx.Button(self.panel,wxID_Delete, "Delete")
        self.close = wx.Button(self.panel,wxID_Close, "Close")
        
        self.save.Disable()
        self.discard.Disable()
        self.delete.Disable()
        
        #boxsizer
        self.hbox_btn = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox_btn.Add(self.save, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
        self.hbox_btn.Add(self.discard, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
        self.hbox_btn.Add(self.new, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
        self.hbox_btn.Add(self.delete, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
        self.hbox_btn.Add(self.close, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
        
        self.vbox.Add(self.hbox_btn, 1, wx.ALIGN_RIGHT | wx.ALL, 5)
        
        self.panel.SetSizer(self.vbox)
        
        self.win.Bind(wx.EVT_BUTTON, self.EvtOnClose, self.close)
        
    def EvtOnClose(self, event):
        """
        Close client window
        """
        
        self.win.Close()
        
        